function getAllUsers() {
    //清空数据
    $("#all_users").empty();
    $(function () {
        $.ajax({
            type: "GET",
            contentType: "application/json;charset=utf-8",
            url: "/yixian/getallusers",
            dataType: "json",
            success: function (res) {

                console.log(res);
                if (res.success) {
                    console.log("success");
                    var html = '';
                    $.each(res.data, function (i, item) {

                        //循环获取数据    
                        // html = html + '<option value="' + item.id + '">' + item.name + '</option>';

                        var array = [];
                        array.push(item);
                        var data = JSON.stringify(array);
                        html = html + '<button type="button" class="btn btn-default" style="width: 200px;text-align: center;margin-top: 5px" onclick=changeTalk(' + data + ')>' + item.name + '<span class="warn" style="" id="' + item.id + "" + '" /></button>';
                    });

                    $('#all_users').html('').append(html);
                }


            }, error: function () {

                console.log(error);

            }

        });

    })

    //点击事件 select使用change
    $('#all_users').change(function () {
        var text = $('#all_users').val();
        console.log(text)
    });

}


function getFriends(userId) {
    $(function () {
        $.ajax({
            type: "POST",
            contentType: "application/json;charset=utf-8",
            url: "/yixian/getfriends",
            data: userId,
            dataType: "string",
            success: function (res) {

                console.log(res);

            }, error: function () {

                console.log(error);

            }

        });

    })
}

